﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Glucometer
{
    class Beeper
    {

        public static void playBeep(BeeperStyle style)
        {
            int frequency = 3000;

            System.Threading.Thread t1 = new System.Threading.Thread
            (
                delegate()
                {
                    switch (style)
                    {
                        case BeeperStyle.SHORT_BEEP:
                            playShortBeep();
                            break;
                        case BeeperStyle.LONG_BEEP:
                            Console.Beep(frequency, 500);
                            break;
                        case BeeperStyle.DOUBLE_BEEP:
                            playShortBeep();
                            Thread.Sleep(200);
                            playShortBeep();
                            break;
                        case BeeperStyle.SHORT_LONG_BEEP:
                            playShortBeep();
                            Thread.Sleep(150);
                            Console.Beep(frequency, 400);
                            break;
                    }
                }
             );
            t1.Start();
        }

        private static void playShortBeep()
        {
            Console.Beep(3000, 200);
        }
    }
}
